<%@include file="common.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
 
 
<title>业务员绩效管理系统</title>
 

<style>
.tree {
	font-size: 12px;
	margin: 0;
	padding: 0;
	list-style-type: none;
}

.tree li {
	white-space: nowrap;
}

.tree li ul {
	list-style-type: none;
	margin: 0;
	padding: 0;
}

.tree-node {
	height: 18px;
	white-space: nowrap;
	cursor: pointer;
}

.tree-indent {
	display: inline-block;
	width: 16px;
	height: 18px;
	vertical-align: middle;
}

.tree-hit {
	cursor: pointer;
}

.tree-expanded {
	display: inline-block;
	width: 16px;
	height: 18px;
	vertical-align: middle;
	background: url('images/menu/ad1.png') no-repeat 0px 0px;
}

.tree-expanded-hover {
	background: url('images/menu/ad1.png') no-repeat 0px 0px;
}

.tree-collapsed {
	display: inline-block;
	width: 16px;
	height: 18px;
	vertical-align: middle;
	background: url('images/menu/ad1.png') no-repeat 0px 0px;
}

.tree-collapsed-hover {
	background: url('images/menu/ad1.png') no-repeat 0px 0px;
}

.tree-folder {
	display: inline-block;
	background: url('images/menu/ar.png') no-repeat;
	width: 16px;
	height: 18px;
	vertical-align: middle;
}

.tree-folder-open {
	background: url('images/menu/ad.png') no-repeat;
}

.tree-file {
	display: inline-block;
	background: url('images/menu/2.gif') no-repeat;
	width: 16px;
	height: 18px;
	vertical-align: middle;
}

.tree-loading {
	/*background:url('images/menu/tree_loading.gif') no-repeat;*/
	
}

.tree-title {
	display: inline-block;
	text-decoration: none;
	vertical-align: middle;
	padding: 1px 2px 1px 2px;
	white-space: nowrap;
}

.tree-node-hover {
	background: #fafafa;
}

.tree-node-selected {
	background: #FBEC88;
}

.tree-checkbox {
	display: inline-block;
	width: 16px;
	height: 18px;
	vertical-align: middle;
}

.tree-checkbox0 {
	background: url('images/tree_checkbox_0.gif') no-repeat;
}

.tree-checkbox1 {
	background: url('images/tree_checkbox_1.gif') no-repeat;
}

.tree-checkbox2 {
	background: url('images/tree_checkbox_2.gif') no-repeat;
}

.tree-node-proxy {
	font-size: 12px;
	padding: 1px 2px 1px 18px;
	background: #fafafa;
	border: 1px solid #ccc;
}

.tree-dnd-yes {
	background: url('images/tree_dnd_yes.png') no-repeat 0 center;
}

.tree-dnd-no {
	background: url('images/tree_dnd_no.png') no-repeat 0 center;
}

.tree-node-top {
	border-top: 1px dotted red;
}

.tree-node-bottom {
	border-bottom: 1px dotted red;
}

.tree-node-append .tree-title {
	border: 1px dotted red;
}

#tipPosition {
	width: 400px;
	height: 16px;
	line-height: 18px;
	padding: 2px 30px;
}

.tip {
	background: #E6F2FF url(images/register_tip.png) no-repeat 10px center;
	border: 1px #0E5863 dashed;
	color: #0E5863;
}

.error {
	background: #FBECDF url(images/register_error.png) no-repeat 10px center;
	border: 1px Red dashed;
	color: #6D3737;
}

.success {
	background: #D6FCD2 url(images/register_success.png) no-repeat 10px
		center;
	border: 1px #2F5D36 dashed;
	color: #3D934A;
}

#pwdStrong_color {
	width: 136px;
	height: 3px;
	border: 0px;
	border-collapse: collapse;
	border-spacing: 0;
	background: #E6EAED;
	margin-top: 5px;
}

#pwdStrong_color td {
	padding: 0px;
	width: 44px; /*如不加td宽度,Google的Chrome不会正常显示*/
}

#pwdStrong_text {
	font: 12px 宋体;
}

.easyui-accordion_fs ul {
	list-style-type: none;
	margin: 0px;
	padding: 10px;
}

.easyui-accordion_fs ul li {
	padding: 0px;
}

.easyui-accordion_fs ul li a {
	line-height: 24px;
}

.easyui-accordion_fs ul li div {
	margin: 2px 0px;
	padding-left: 0px;
	padding-top: 2px;
}

.easyui-accordion_fs ul li div.hover {
	border: 1px dashed #99BBE8;
	background: #E0ECFF;
	cursor: pointer;
}

.easyui-accordion_fs ul li div.hover a {
	color: #416AA3;
}

.easyui-accordion_fs ul li div.selected {
	border: 1px solid #99BBE8;
	background: #E0ECFF;
	cursor: default;
}

.easyui-accordion_fs ul li div.selected a {
	color: #416AA3;
	font-weight: bold;
}
</style>
<script type="text/javascript">
	var tabs;

	$(function() {

		tabs = $('#tabs').tabs({});

		//查询用户的菜单
		$
				.ajax({
					url : 'showLimitMenu.do',
					type : 'post',
					success : function(data) {
						var menus = data.rows;

						if (menus == null || menus.length == 0) {
							$(".easyui-accordion_fs")
									.html(
											'<div align="center"><font color="red"><b>对不起，您没有菜单权限，请联系管理员。</b></font></div>');

						} else {
							InitLeftMenu(menus);
							tabClose();
							tabCloseEven();
						}
					}
				});

		// 查看自身信息
		$('#showSelfInfo').click(function(){
			//addTab("查看自身信息","AZ18!showIndex.do","page-grxx");
		});	
    
		// 查看自身角色
		$('#showSelfRole').click(function(){
			var key = $('#key').val();
			var url = 'A_USR!showInfo.do?model.key=' + key;
			openWin(url,'pop'); 
		});

		/* 代办事项数据请求并赋值*/
/* 		 $.ajax({
			  	url : 'showAgencyCount.do',
				type : 'post',
				success :function(data){
					var contents = '';
					if(data.agencyCount>0){						
						contents+='<tr><td height="25px"><a href="javascript:void(0)" onclick=\'addTab("代办事项","P_WF_ORDER!showAgencyIndex.do", "s")\'>'+
						'<span id="showAgency" style="color:#6699cc;font-size:14px;"><img src="images/menu/ad1.png" />代办事项 ( '  + data.agencyCount +  ' ) </a></span></td></tr>';
						
						$('#mainText').append(contents);
					}
				}
		 }); */
    
		// 修改密码
		$('#editpass').click(function() {
			var url = 'showChangePass.do?operationType=30';
			//openWin(url, 'pop', 600, 400);
		});

		// 安全退出
		$('#loginOut').click(function() {
			/* 
			 * 注意：点击“安全退出”后，弹出提示框可能被报表插件窗体隐藏,以下代码当弹出提示框后，隐藏所有的iframe
			 * 若用户选择取消提示框，则恢复显示iframe
			 */
			var iframes = $(document).find("iframe");
			//iframes.each(function() {
			//	$(this).hide();
			//});

			$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function(r) {
				if (r) {
					location.href = 'doLogout.do';
				} 
				//else {
				//	iframes.each(function() {
				//		$(this).show();
				//	});
				//}
			});
		});

		// 安全退出
		$('#help').click(function() {
			/* 
			 * 注意：点击“安全退出”后，弹出提示框可能被报表插件窗体隐藏,以下代码当弹出提示框后，隐藏所有的iframe
			 * 若用户选择取消提示框，则恢复显示iframe
			 */
			var iframes = $(document).find("iframe");
			//iframes.each(function() {
			//	$(this).hide();
			//});
			showHelpWin()
		});
	});

	//初始化主窗口左侧的导航菜单
	function InitLeftMenu(menus) {

		var menulist = "";
		var childrenMenu = [];

		for ( var i = 0, len = menus.length; i < len; i++) {
			menulist += '<div title="'+menus[i].attributes.menu_name+'"  icon="" style="overflow:auto;">';
			menulist += '<ul id="tree' + childrenMenu.length + '"></ul>';
			menulist += '</div>';

			childrenMenu[childrenMenu.length] = menus[i].children;
		}

		//导航菜单绑定初始化
		$(".easyui-accordion_fs").append(menulist);
		$(".easyui-accordion_fs").accordion({
			animate : false
		});

		for ( var j = 0; j < childrenMenu.length; j++) {
			var tree = $('#tree' + j).tree({
				onClick : function(node) {
					if (node.attributes.is_leaf == 1) {

						var tabTitle = node.text;
						var url = node.attributes.menu_link_address;
						var icon = "";//node.attributes.ftblj;

						addTab(tabTitle, url, icon);
					} else {
						$(this).tree('toggle', node.target);
					}
				}
			});
			tree.tree('loadData', childrenMenu[j]);
		}
	}

	function addTab(subtitle, url, icon) {
		if (!tabs.tabs('exists', subtitle)) {
			tabs.tabs('add', {
				title : subtitle,
				content : createFrame(url),
				closable : true
			/*,icon:icon*/
			});
		} else {
			tabs.tabs('select', subtitle);
		}
		tabClose();
	}

	function createFrame(url) {
		var s = '<iframe scrolling="auto" frameborder="0"  src="' + url
				+ '" style="width:100%;height:100%;"></iframe>';
		return s;
	}

	function tabClose() {
		/*双击关闭TAB选项卡*/
		$(".tabs-inner").dblclick(function() {
			var subtitle = $(this).children(".tabs-closable").text();
			tabs.tabs('close', subtitle);
		});
		/*为选项卡绑定右键*/
		$(".tabs-inner").bind('contextmenu', function(e) {
			$('#mm').menu('show', {
				left : e.pageX,
				top : e.pageY
			});

			var subtitle = $(this).children(".tabs-closable").text();

			$('#mm').data("currtab", subtitle);
			tabs.tabs('select', subtitle);
			return false;
		});
	}

	//绑定右键菜单事件
	function tabCloseEven() {
		//关闭当前
		$('#mm-tabclose').click(function() {
			var currtab_title = $('#mm').data("currtab");
			tabs.tabs('close', currtab_title);
		});
		//全部关闭
		$('#mm-tabcloseall').click(function() {
			$('.tabs-inner span').each(function(i, n) {
				var t = $(n).text();
				if (t == '' || t == '欢迎使用') {
					return true;
				}
				tabs.tabs('close', t);
			});
		});
		//关闭除当前之外的TAB
		$('#mm-tabcloseother').click(function() {
			var currtab_title = $('#mm').data("currtab");
			$('.tabs-inner span').each(function(i, n) {
				var t = $(n).text();
				if (t == '' || t == '欢迎使用') {
					return true;
				}
				if (t != currtab_title)
					tabs.tabs('close', t);
			});
		});
		//关闭当前右侧的TAB
		$('#mm-tabcloseright').click(function() {
			var nextall = $('.tabs-selected').nextAll();
			if (nextall.length == 0) {
				return false;
			}
			nextall.each(function(i, n) {
				var t = $('a:eq(0) span', $(n)).text();
				if (t == '' || t == '欢迎使用') {
					return true;
				}
				tabs.tabs('close', t);
			});
			return false;
		});
		//关闭当前左侧的TAB
		$('#mm-tabcloseleft').click(function() {
			var prevall = $('.tabs-selected').prevAll();
			if (prevall.length == 0) {
				return false;
			}
			prevall.each(function(i, n) {
				var t = $('a:eq(0) span', $(n)).text();
				if (t == '' || t == '欢迎使用') {
					return true;
				}
				tabs.tabs('close', t);
			});
			return false;
		});

		//退出
		$("#mm-exit").click(function() {
			$('#mm').menu('hide');
		});
	}
</script>

</head>
 
<body class="easyui-layout">


  <div region="north" title="" split="false" style="height: 54px; padding: 0px;">
    <div id="header">
       <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
          <tr>
           <%-- 安全运维管理平台   
          <td height="50" width="254" background="<c:url value="/images/main/main-logo.gif"/>" style="background-repeat: no-repeat"></td>
          --%>
           <%-- 安全内控管理平台   --%>
            <td height="50" width="254" background="<c:url value="/images/main/main-nk-logo.jpg"/>" style="background-repeat: no-repeat"></td>
           
            <td valign="top" background="<c:url value="/images/main/bar-bg.gif"/>" style="background-repeat: repeat-x; padding-top: 6px; padding-left: 10px"></td> 
            <td width="300" background="<c:url value="/images/main/bar-bg.gif"/>" style="background-repeat: repear-x" valign="middle" align="center">
              <font color="black">用户：${session_user.login_name }&nbsp;</font> | &nbsp;
              <a href="#" id="loginOut">安全退出</a><!-- | &nbsp; -->
           <!--    <a href="#" id="help">联机帮助</a> -->
            </td>
        </table>
    </div>
  </div>

  <div region="west" split="true" title="导航菜单" style="width: 180px;" id="west">
    <div class="easyui-accordion_fs" fit="true" border="false"></div>
  </div>

  <div id="mainPanle" region="center" style="background: #eee; overflow-y: hidden">
    <div id="tabs" class="" fit="true" border="false">
      <div title="欢迎使用" style="padding: 20px; overflow: hidden;" id="home" icon="page-home" closable="false">
		<input type="hidden" id="key" value="${session_user.usr_id}" />
        <table style="margin-bottom: 2em">
          <tbody>
            <tr>
              <td><span style="color:#6699cc;font-size:14px;font-weight:bold;">欢迎使用业务员管理系统</span></td>
            </tr>
            <tr>
              <td>
                <table id="mainText" style="padding-left: 2em">
                  <tbody>
                                                        本系统只为了更好给业务员做业绩提成返点，切勿商用化。
<!--                     <tr>
                      <td height="25px">
                      <a id="showSelfInfo" href="#">
                      <span id="showSelfRole" style="color:#6699cc;font-size:14px;">
                      <img src="images/menu/ad1.png" />查看自身信息</span></a>
                      </td>
                    </tr> -->
                  </tbody>
                </table></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>

  <%-- 右键菜单 --%>
  <div id="mm" class="easyui-menu" style="width: 150px;">
    <div id="mm-tabclose">关闭</div>
    <div id="mm-tabcloseall">全部关闭</div>
    <div id="mm-tabcloseother">除此之外全部关闭</div>
    <div class="menu-sep"></div>
    <div id="mm-tabcloseright">当前页右侧全部关闭</div>
    <div id="mm-tabcloseleft">当前页左侧全部关闭</div>
    <div class="menu-sep"></div>
    <div id="mm-exit">退出</div>
  </div>

</body>
</html>




